<template>
  <div class="checkUserDialog">
    <el-button type="text" size="small" @click="look()">查看</el-button>
    <el-dialog class="userInfoDialog"   title="查看用户"   v-model="dialogFormVisible" :close-on-click-modal="false">
      <div style="overflow: hidden;">
      <el-form :model="userInfo" label-position="right" label-width="120px" class="userInfoForm">
        <el-col :span="8">
          <el-form-item label="账户">
            <el-input v-model="userInfo.name" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="创建者姓名">
            <el-input v-model="userInfo.creatorName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="身份证号">
            <el-input v-model="userInfo.identity" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="年龄">
            <el-input v-model="userInfo.age" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="推荐客户数" prop="relUserNum">
            <el-input v-model="userInfo.relUserNum" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="部门"  >
            <el-input type="textarea" v-model="userInfo.orgDepName"  :disabled="true" class="orgDepName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="姓名" prop="realName">
            <el-input v-model="userInfo.realName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="所属职务" prop="orgName">
            <el-input v-model="userInfo.orgName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="生日" prop="birthday">
            <el-input v-model="birthday" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="理财师姓名" prop="finUserName">
            <el-input v-model="userInfo.finUserName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="绑卡客户数" prop="relTieCardUserNum">
            <el-input v-model="userInfo.relTieCardUserNum" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="入职日期" prop="entryTime">
            <el-input v-model="entryTime" :disabled="true"></el-input>
          </el-form-item>
          <!--<el-form-item label="所属角色" prop="sysRoleNames">-->
            <!--<el-input type="textarea" v-model="userInfo.sysRoleNames" :disabled="true" class="sysRoleNames"></el-input>-->
          <!--</el-form-item>-->
        </el-col>
        <el-col :span="8">
          <el-form-item label="所属渠道" prop="channelName">
            <el-input v-model="userInfo.channelName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="是否为理财师" prop="isInside">
            <el-input v-model="isInside" :disabled="true">
            </el-input>
          </el-form-item>
          <el-form-item label="省市" prop="location">
            <el-input v-model="userInfo.location" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="理财师部门" prop="finDepFullName">
            <el-input type="textarea" v-model="userInfo.finDepFullName" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="推荐码" prop="recommendCode">
            <el-input v-model="userInfo.recommendCode" :disabled="true"></el-input>
          </el-form-item>
          <el-form-item label="离职日期" prop="leaveTime">
            <el-input v-model="leaveTime" :disabled="true"></el-input>
          </el-form-item>
        </el-col>
      </el-form>
      </div>
      <div>
        <el-button class="cancel" @click="cancel">取消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
  import {jsUtils} from 'util/util.js';
  export default {
    props:['id'],
    data() {
      return {
        check:true,
        userInfo:{
          isInside:'',
          entryTime:'',
          birthday:'',
          leaveTime:''
        },
        isInside:'',
        entryTime:'',
        birthday:'',
        leaveTime:'',
        form: {
            creator:'',
            name:'',
            roleType:'',
            description:''
        },
        dialogFormVisible: false,
      };
    },
    methods:{
      getData () {
        var parm = {
            "id": this.id
        };
        var url = '/api-hks/v1/mgr/SysUserCtrl/getSysUserById';
        this.$http.post(url, parm).then((response) => {
          this.userInfo = response.body.result;
          this.chgFieldValue();
        });
      },
      cancel(){
          this.dialogFormVisible=false
      },
      toEdit(){
          this.check=false
      },
      look(){
          this.dialogFormVisible=true;
          this.getData();
      },
      chgFieldValue(){
        console.log("in the change method");
        if(this.userInfo.isInside === 1){
          this.isInside = "是";
        }else{
          this.isInside = "否";
        }


        if(this.userInfo.entryTime != null){
          this.entryTime = jsUtils.getSmpFormatDate(this.userInfo.entryTime, false);
        }

        if(this.userInfo.birthday != null) {
          this.birthday = jsUtils.getSmpFormatDate(this.userInfo.birthday, false);
        }

        if(this.userInfo.leaveTime != null){
          this.leaveTime = jsUtils.getSmpFormatDate(this.userInfo.leaveTime, false);
        }

      }
    }
  };
</script>
<style scoped>
    .userInfoDialog{
      padding: 50px;
    }
</style>
